#define _CRT_SECURE_NO_WARNINGS 1


#include <iostream>
#define int long long
using namespace std;
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
int q[N], qq[N];
bool st[N];
int n;
signed main() {
	scanf("%lld", &n);
	int ma = -1, sum = 0;
	for (int i = 0;i < n;i++) {
		scanf("%lld", &q[i]);
		if (ma < q[i]) ma = q[i];
		sum += q[i];
	}
	sum += (n - 1) * ma;
	sum -= ma;
	printf("%lld", sum);
	return 0;
}